package stackoverflow.domain.service;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import stackoverflow.domain.service.impl.UserAssembler;
import stackoverflow.domain.service.impl.UserServiceImpl;
import stackoverflow.domain.shared.IdGenerator;
import stackoverflow.domain.user.User;
import stackoverflow.domain.user.UserRepository;


public class UserServiceTest
{
	private UserRepository userRepository;
	private UserService userService;
	private UserAssembler userAssembler;
	private IdGenerator idGenerator;
	
	@Before
	public void setUp()
	{
		userRepository = Mockito.mock(UserRepository.class);
		idGenerator = Mockito.mock(IdGenerator.class);
		userAssembler = Mockito.mock(UserAssembler.class);
		userService = new UserServiceImpl(userRepository, userAssembler);
	}
	
	@Test
	public void simpleUserCreation()
	{
		Mockito.when(idGenerator.createId()).thenReturn("1");
		User user = userService.createNewUser("userName", "password");
		Assert.assertEquals("", "userName", user.getUserName());
	}

//	@Test
//	public void getUser()
//	{
//		UserId userId1=new UserId("1");
//		Mockito.when(userRepository.NextUserId()).thenReturn(userId1);
//		UserService userService = new UserServiceImpl(userRepository);
//		UserId userId2 = userService.createNewUser();
//		User userId2 = userService.createNewUser();
//	}
	
//	@Test
//	public void 
	
//	@Test
//	public void createdUsersHaveDifferentUserIds()
//	{
//		UserService userService = Mockito.mock(UserService.class);
//		UserId userId1 = userService.createNewUser();
//		UserId userId2 = userService.createNewUser();
//		Assert.assertFalse(userId1.equals(userId2));
//	}
	
}
